﻿using MediatR;
using T.Basic.API.Appliction.Command.VehicleCommand;
using T.Basic.Repository.BasicInterface;

namespace T.Basic.API.Appliction.CommandHandlers.VehicleHanders
{
    /// <summary>
    /// 新增车辆管理
    /// </summary>
    public class VehicleCreateCommandHander : IRequestHandler<VehicleCreateCommand, int>
    {
        private readonly IVehicleRepository _vehicleRepository;
        public VehicleCreateCommandHander(IVehicleRepository vehicleRepository) 
        { 
            _vehicleRepository = vehicleRepository;
        }
        public async Task<int> Handle(VehicleCreateCommand request, CancellationToken cancellationToken)
        {
            return await _vehicleRepository.AddAsync(request);
        }
    }
}
